package com.rc.saas.tenant.client;

import com.rc.saas.tenant.common.vo.TResponse;
import com.rc.saas.tenant.vo.elec.UnlockReq;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * B区充电桩服务器
 * value 和 name 互为别名，也是指被调用的微服务名称。
 * path如果是本机开发模式,一般不需设置,如果在生产上一个tomcat部署多个项目，一定需设置为项目的子路径
 * @FeignClient(name = "服务名") 亦可写作 @FeignClient(value= "服务名")
 * Created by sven on 2019/10/25
 */
@Component
@FeignClient(name = StdEvchargerClient2.SERVICE_NAME, path = StdEvchargerClient2.SERVICE_PATH)
//name是服务方的spring.application.name,指被调用的微服务名称
public interface StdEvchargerClient2 {
    //项目名称
    String SERVICE_NAME = "rc-evcharger2";
    //项目部署的路径
    String SERVICE_PATH = "/rc-evcharger";

    /**
     * 测试地十：http://localhost:8181/client/test/3
     * 路径跟入参和server端的controller方法一样
     * @return
     */
    @GetMapping("/micro/test/{id}")
    @ResponseBody
    String test(@PathVariable(value = "id") Long id);

    /**
     * 解锁指令
     * equestMapping路径是服务提供方的路径
     * @param unlockReq
     * @return
     */
    @RequestMapping(value = "/command/sendUnlock", method = RequestMethod.POST)
    TResponse sendUnlock(@RequestBody UnlockReq unlockReq);

    /**
     * 后台结算订单(反向订单,自主订单)
     * RequestMapping路径是服务提供方的路径
     * @param orderId
     * @return
     */
    @RequestMapping(value = "/order/updateOrder", method = RequestMethod.POST)
    TResponse updateOrder(@RequestParam("orderId") Long orderId);

    /**
     * 后台结算订单(反向订单,自主订单)
     * @param orderId
     * @param authorization
     * @return
     */
    @RequestMapping(value = "/order/updateOrderCostHlht1", method = RequestMethod.POST)
    TResponse updateOrderCostHlht1(@RequestParam("tenantCode") String tenantCode, @RequestParam("orderId") Long orderId, @RequestHeader("Authorization") String authorization);

    /**
     * 后台结算订单(正向互联互通订单)
     * RequestMapping路径是服务提供方的路径
     * @param orderId
     * @return
     */
    @RequestMapping(value = "/order/updateOrderCostHlht2", method = RequestMethod.POST)
    TResponse updateOrderCostHlht2(@RequestParam("orderId") Long orderId);
}